#include <stdio.h>

int main()
{
    int n, sum, floor, i, last =0;
    while(scanf("%d", &n)==1)
    {
        if(n==0)
        {
            break;
        }
        sum = 0;
        last = 0;
        for (i = 0; i < n;i++)
        {
            scanf("%d", &floor);
            if(floor-last>=0)
            {
                sum += ((floor - last) * 6 + 5);
            }
            else
            {
                sum += ((last - floor) * 4 + 5);
            }
            last = floor;
        }
        printf("%d\n", sum);
    }
    return 0;
}